#include "itementity.h"

#include "application.h"
#include "serviceentity.h"
#include "graphics/graphicsmanager.h"

#include "graphics/texturemanager.h"
#include "graphics.opengl/texture.h"
#include "graphics/texture.h"


namespace infinity {

/*virtual*/ void ItemEntity::renderDebug()
{
	super::renderDebug();


// 	dw::graphics::Renderer& renderer(dw::graphics::GraphicsManager::getInstance().getRenderer());
// 	const Matrix4f& objectMtx = m_Transform;
// 
// 	renderer.pushState();
// 	
// 	renderer.setRenderState(dw::graphics::Renderer::RS_DEPTH_TEST, true);
// 
// 	renderer.setMatrixMode(dw::graphics::Renderer::MODELVIEW);
// 	renderer.pushMatrix();
// 	renderer.multMatrix(objectMtx);
// 
// 	dw::graphics::ITexture* tex = dw::graphics::TextureManager::getInstance().loadTexture("terrain.png");
// 	renderer.setTexture(tex);
// 	renderer.setRenderState(dw::graphics::Renderer::RS_LIGHTING, false);
// 
// 	dw::maths::Vector2f upleft(2/16.0f,8/16.f);
// 	float sizecell = 1/16.0f;
// 
// 	glBegin(GL_QUADS);
// 	glColor4f(1.0f,1.0f,1.0f,0.3f);
// 	// Front Face
// 	glNormal3f( 0.0f, 0.0f, 1.0f);
// 	glTexCoord2f(upleft.x, upleft.y); glVertex3f(0.0f, 0.0f,  1.f);	// Bottom Left Of The Texture and Quad
// 	glTexCoord2f(upleft.x + sizecell, upleft.y); glVertex3f( 1.0f, 0.f,  1.0f);	// Bottom Right Of The Texture and Quad
// 	glTexCoord2f(upleft.x + sizecell, upleft.y + sizecell); glVertex3f( 1.0f,  1.0f,  1.0f);	// Top Right Of The Texture and Quad
// 	glTexCoord2f(upleft.x , upleft.y + sizecell); glVertex3f(0.f,  1.0f,  1.0f);	// Top Left Of The Texture and Quad
// 	// Back Face
// 	glNormal3f( 0.0f, 0.0f,-1.0f);
// 	glTexCoord2f(upleft.x + sizecell, upleft.y); glVertex3f(0.f, 0.f, 0.f);	// Bottom Right Of The Texture and Quad
// 	glTexCoord2f(upleft.x + sizecell, upleft.y + sizecell); glVertex3f(0.f,  1.0f, 0.f);	// Top Right Of The Texture and Quad
// 	glTexCoord2f(upleft.x , upleft.y + sizecell); glVertex3f( 1.0f,  1.0f, 0.f);	// Top Left Of The Texture and Quad
// 	glTexCoord2f(upleft.x , upleft.y ); glVertex3f( 1.0f, 0.f, 0.f);	// Bottom Left Of The Texture and Quad
// 
// 
// 	upleft = dw::maths::Vector2f(2/16.0f,7/16.f);
// 
// 	// Top Face
// 	glNormal3f( 0.0f, 1.0f, 0.0f);
// 	glTexCoord2f(upleft.x + sizecell, upleft.y ); glVertex3f(0.f,  1.0f, 0.f);	// Top Left Of The Texture and Quad
// 	glTexCoord2f(upleft.x , upleft.y ); glVertex3f(0.f,  1.0f,  1.0f);	// Bottom Left Of The Texture and Quad
// 	glTexCoord2f(upleft.x , upleft.y + sizecell); glVertex3f( 1.0f,  1.0f,  1.0f);	// Bottom Right Of The Texture and Quad
// 	glTexCoord2f(upleft.x + sizecell, upleft.y + sizecell); glVertex3f( 1.0f,  1.0f, 0.f);	// Top Right Of The Texture and Quad
// 	// Bottom Face
// 	glNormal3f( 0.0f,-1.0f, 0.0f);
// 	glTexCoord2f(upleft.x + sizecell, upleft.y + sizecell); glVertex3f(0.f, 0.f, 0.f);	// Top Right Of The Texture and Quad
// 	glTexCoord2f(upleft.x , upleft.y + sizecell); glVertex3f( 1.0f, 0.f, 0.f);	// Top Left Of The Texture and Quad
// 	glTexCoord2f(upleft.x , upleft.y ); glVertex3f( 1.0f, 0.f,  1.0f);	// Bottom Left Of The Texture and Quad
// 	glTexCoord2f(upleft.x + sizecell, upleft.y); glVertex3f(0.f, 0.f,  1.0f);	// Bottom Right Of The Texture and Quad
// 
// 	upleft = dw::maths::Vector2f(3/16.0f,8/16.f);
// 	// Right face
// 	glNormal3f( 1.0f, 0.0f, 0.0f);
// 	glTexCoord2f(upleft.x + sizecell, upleft.y); glVertex3f( 1.0f, 0.f, 0.f);	// Bottom Right Of The Texture and Quad
// 	glTexCoord2f(upleft.x + sizecell, upleft.y + sizecell); glVertex3f( 1.0f,  1.0f, 0.f);	// Top Right Of The Texture and Quad
// 	glTexCoord2f(upleft.x , upleft.y + sizecell); glVertex3f( 1.0f,  1.0f,  1.0f);	// Top Left Of The Texture and Quad
// 	glTexCoord2f(upleft.x , upleft.y ); glVertex3f( 1.0f, 0.f,  1.0f);	// Bottom Left Of The Texture and Quad
// 	// Left Face
// 	glNormal3f(-1.0f, 0.0f, 0.0f);
// 	glTexCoord2f(upleft.x , upleft.y ); glVertex3f(0.f, 0.f, 0.f);	// Bottom Left Of The Texture and Quad
// 	glTexCoord2f(upleft.x + sizecell, upleft.y); glVertex3f(0.f, 0.f,  1.0f);	// Bottom Right Of The Texture and Quad
// 	glTexCoord2f(upleft.x + sizecell, upleft.y + sizecell); glVertex3f(0.f,  1.0f,  1.0f);	// Top Right Of The Texture and Quad
// 	glTexCoord2f(upleft.x , upleft.y + sizecell); glVertex3f(0.f,  1.0f, 0.f);	// Top Left Of The Texture and Quad
// 	glEnd();
// 
// 	renderer.popState();
// 	renderer.popMatrix();

}

/*virtual*/ ItemEntity::~ItemEntity()
{
}


/*virtual*/ void ItemEntity::leftClick()
{
	dwLogDebug("LeftClick !!!");
}
/*virtual*/ void ItemEntity::rightClick()
{
	dwLogDebug("RightClick !!!");
}


} // namespace infinity
